<template>
  <div class="category-title">
    <div class="category-content">
      <div class="title-group">
        <div class="title" @click="() => emit('titleClick')">
          {{ title }}
        </div>
        <div class="title-sub">
          {{ titleSub.toUpperCase() }}
        </div>
      </div>
      <div v-if="hasExport" class="title-export" @click="emit('export')">
        <span>导出</span>
        <span class="icon">▲</span>
      </div>
      <div v-if="hasFilter" class="title-filter">
        <span>筛选</span>
        <span class="icon">▲</span>
      </div>
      <div v-if="unfold" class="title-filter" @click="unfoldChange">
        <span>{{ unfoldName }}</span>
        <!--        <span class="icon">▲</span>-->
      </div>
    </div>
  </div>
</template>

<script setup>
// eslint-disable-next-line no-undef
defineProps({
  title: {
    type: String,
    default: "",
  },
  titleSub: {
    type: String,
    default: "",
  },
  unfoldName: {
    type: String,
    default: "",
  },
  hasExport: {
    type: Boolean,
    default: false,
  },
  hasFilter: {
    type: Boolean,
    default: false,
  },
  unfold: {
    type: Boolean,
    default: false,
  },
});

// eslint-disable-next-line no-undef
const emit = defineEmits(["titleClick", "unfoldChange", "export"]);

const unfoldChange = () => {
  emit("unfoldChange")
};
</script>

<style lang="less" scoped>
@import "./index.less";
</style>
